package com.gears_software.sxdc.dccx.data.finder;

import com.gears_software.sxdc.dccx.data.finder.util.GearsAuthInterceptor;
import com.gears_software.sxdc.dccx.data.model.CPOrderDetailModel;
import com.gears_software.sxdc.dccx.data.model.CPOrderListDetailModel;
import com.gears_software.sxdc.dccx.data.model.CPOrderModel;
import com.gears_software.sxdc.dccx.data.model.CheckCancelModel;
import com.gears_software.sxdc.dccx.data.model.LineInfoModel;
import com.gears_software.sxdc.dccx.data.model.MyTripModel;
import com.gears_software.sxdc.dccx.data.model.MyTripPassengerDetailModel;
import com.gears_software.sxdc.dccx.data.model.PagedResultModel;
import com.gears_software.sxdc.dccx.data.model.request.RCheckDriverCancelModel;
import com.gears_software.sxdc.dccx.data.model.request.RCheckPassengerCancelModel;
import com.gears_software.sxdc.dccx.data.model.request.RDriverCancelModel;
import com.gears_software.sxdc.dccx.data.model.ResultModel;
import com.gears_software.sxdc.dccx.data.model.request.RCPOrderModel;
import com.gears_software.sxdc.dccx.data.model.request.RDriverArrivedModel;
import com.gears_software.sxdc.dccx.data.model.request.RPassengerArrivedModel;
import com.gears_software.sxdc.dccx.data.model.request.RPassengerCancelModel;
import com.gears_software.sxdc.dccx.data.model.request.RPassengerDealCancel;
import com.gears_software.sxdc.dccx.data.model.request.RReserveModel;

import org.androidannotations.rest.spring.annotations.Body;
import org.androidannotations.rest.spring.annotations.Get;
import org.androidannotations.rest.spring.annotations.Path;
import org.androidannotations.rest.spring.annotations.Post;
import org.androidannotations.rest.spring.annotations.Rest;
import org.androidannotations.rest.spring.api.RestClientErrorHandling;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

import java.util.List;

/**
 * Created by chezhenzhen on 2017/8/3.
 */

@Rest(rootUrl = RequestUrl.ROOT, converters = {MappingJackson2HttpMessageConverter.class}, interceptors = GearsAuthInterceptor.class)
public interface ICPOrderFinder extends RestClientErrorHandling {
    //路线信息
    @Get("/api/cporder/line")
    ResultModel<List<LineInfoModel>> getLineInfoList();

    //根据id获取路线信息
    @Get("/api/cporder/line?id={id}")
    ResultModel<LineInfoModel> getLineInfoById(@Path String id);

    //发布行程
    @Post("/api/cporder/add")
    ResultModel<String> addCPOrder(@Body RCPOrderModel rcpOrderModel);

    //修改行程
    @Post("/api/cporder/update?id={id}")
    ResultModel<CPOrderModel> updateCPOrder(@Path String id, @Body RCPOrderModel rcpOrderModel);

    //乘客首页行程列表
    @Get("/api/cporder/page?pageSize={pageSize}&currentPage={currentPage}&filter={filter}&sort={sort}")
    PagedResultModel<CPOrderModel> getCPOrderList(@Path int pageSize, @Path int currentPage, @Path String filter, @Path String sort);

    //车主首页行程列表
    @Get("/api/cporder/drivers_order?currentPage={currentPage}&sort={sort}")
    PagedResultModel<CPOrderModel> getDriverOrderList(@Path int currentPage, @Path String sort);

    //乘客预约
    @Post("/api/cporder/reserve")
    ResultModel<String> getReserve(@Body RReserveModel model);

    //司机行程详情页
    @Get("/api/cporder/order_detail?id={id}")
    ResultModel<CPOrderListDetailModel> getDriverOrderDetail(@Path String id);

    //司机确定乘客预定
    @Get("/api/cporder/accept?id={id}")
    ResultModel<String> goAccept(@Path String id);

    //司机到达指定位置
    @Post("/api/cporder/driver_arrived")
    ResultModel<String> driverArrived(@Body RDriverArrivedModel model);

    //乘客到达指定位置
    @Post("/api/cporder/customer_arrived")
    ResultModel<String> passengerArrived(@Body RPassengerArrivedModel model);

    //我的行程单
    @Get("/api/cporder/my_carpool_orders")
    ResultModel<List<MyTripModel>> getMyCarPoolOrder();

    //乘客订单详情页
    @Get("/api/cporder/my_carpool_detail?id={id}")
    ResultModel<MyTripPassengerDetailModel> getMyTripPassengerDetail(@Path String id);

    //司机取消
    @Post("/api/cporder/driver_cancel")
    ResultModel<String> goDriverCancel(@Body RDriverCancelModel model);

    //查看司机取消订单详情
    @Get("/api/cporder/detail?id={id}")
    ResultModel<CPOrderDetailModel> getPassengerDetail(@Path String id);

    //乘客取消
    @Post("/api/cporder/passenger_cancel")
    ResultModel<String> goPassengerCancel(@Body RPassengerCancelModel cancelModel);

    //乘客同意或拒绝司机申请取消
    @Post("/api/cporder/passenger_dealcancel")
    ResultModel<String> goPassengerDealCancel(@Body RPassengerDealCancel dealCancel);

    //设为车满
    @Get("/api/cporder/fill?id={id}")
    ResultModel<String> setVehicleFull(@Path String id);

    //乘客取消订单前置方法
    @Post("/api/cporder/checkpcorderpassengercancel")
    ResultModel<CheckCancelModel> checkPassengerCancel(@Body RCheckPassengerCancelModel cancelModel);

    //司机取消拼车订单前置方法
    @Post("/api/cporder/checkpcorderdrivercancel")
    ResultModel<CheckCancelModel> checkDriverCancel(@Body RCheckDriverCancelModel cancelModel);


}
